package com.ethink.warehouse.converter;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import com.ethink.framework.common.converter.Converter;
import com.ethink.warehouse.api.info.MateInventoryTypeChangeLogDetailInfo;
import com.ethink.warehouse.common.entity.MateInventoryTypeChangeLogDetail;

/**
 * 库存状态变更明细 Converter转换器
 *
 * @author default
 * @date 2023-01-14
 */
@Component
public class MateInventoryTypeChangeLogDetailConverter implements Converter<MateInventoryTypeChangeLogDetailInfo, MateInventoryTypeChangeLogDetail> {

    @Override
    public MateInventoryTypeChangeLogDetail convertTo(MateInventoryTypeChangeLogDetailInfo info) {
        if(info == null) {
            return null;
        }
        MateInventoryTypeChangeLogDetail entity = new MateInventoryTypeChangeLogDetail ();
        BeanUtils.copyProperties(info, entity);
        return entity;
    }

    @Override
    public MateInventoryTypeChangeLogDetailInfo convertFrom(MateInventoryTypeChangeLogDetail entity) {
        if(entity == null) {
            return null;
        }
        MateInventoryTypeChangeLogDetailInfo info = new MateInventoryTypeChangeLogDetailInfo();
        BeanUtils.copyProperties(entity, info);
        return info;
    }
}
